package com.yyk.yykywd.util;

import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Administrator on 2019/1/17 0017.
 */

public class JianpanTanchuUtil {
    private static JianpanTanchuUtil uploadUtil;

    private JianpanTanchuUtil() {

    }

    /**
     * 单例模式获取Dialog工具类
     *
     * @return
     */
    public static JianpanTanchuUtil getIntanse() {
        if (null == uploadUtil) {
            uploadUtil = new JianpanTanchuUtil();
        }
        return uploadUtil;
    }

    /**
     * 自动弹出键盘输入框
     */
    public void initRuanjianpan(final Context context, final EditText editText) {
        editText.setFocusable(true);
        editText.setFocusableInTouchMode(true);
        editText.requestFocus();
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
                           public void run() {
                               InputMethodManager inputManager =
                                       (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
                               inputManager.showSoftInput(editText, 0);
                           }
                       },
                200);
    }

}
